<?php
/** @var OportunidadController $this */
/** @var Oportunidad $model */
/** @var AweActiveForm $form */
// Prevenir que jquery se cargue dos veces
Yii::app()->clientScript->scriptMap['jquery.js'] = false;
Yii::app()->clientScript->scriptMap['jquery.min.js'] = false;
Yii::app()->clientScript->scriptMap['jquery.yiigridview.js'] = false;
$form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array(
    'type' => 'horizontal',
    'id' => 'entidad-foto-form',
    'enableAjaxValidation' => true,
    'clientOptions' => array('validateOnSubmit' => false, 'validateOnChange' => false,),
    'enableClientValidation' => false,
        ));

$msj = "Agregar Fotos";
Util::tsRegisterAssetJs('_form_modal_entidad_foto.js');
?>
<div class="modal-dialog modal-lg">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
            <h4 class="modal-title" id="myModalLabel"><?php echo $msj ?></h4>
        </div>
        <div class="modal-body">
            <div class="form-group">
                <label class="control-label required col-sm-3" for="EntidadFoto_ruta">Foto <span class="required">*</span></label>
                <div class="col-sm-9">
                    <?php
                    $htmlOptions = array('class' => "form-control");

                    echo $form->hiddenField($model, 'ruta', $htmlOptions);
                    ?>
                   
                    <div id="select_row">
                        <button id="btn_upload_action" class="btn btn-mini">
                            <i class="icon icon-plus"></i> Seleccione
                        </button>
                        <input type="file" id="file_temp" class="hidden">
                    </div>
                    <div id="prev_row" hidden>
                        <div class="row-fluid">
                            <img id="img_prev" data-src="holder.js/100%x200" alt="100%x300" src="#">

                            <!--<a id="prev_file" href="#"></a>-->
                        </div>
                        <div class="row-fluid">
                            <button id="btn_change_action" class="btn btn-mini btn-primary">
                                <i class="icon-white icon-search"></i> Cambiar
                            </button>
                            <button id="btn_delete_action" class="btn btn-mini btn-danger">
                                <i class="icon-white icon-stop"></i> Eliminar
                            </button>
                        </div>
                    </div>
                     <?php echo $form->error($model, 'ruta'); ?>   
                </div>


            </div>
     
            <?php echo $form->textFieldGroup($model, 'nombre', array('maxlength' => 256)) ?>
            <?php echo $form->hiddenField($model, 'entidad_id') ?>

        </div>
        <div class="modal-footer">
            <?php
            $this->widget('booster.widgets.TbButton', array(
                'buttonType' => 'success',
                'icon' => 'ok',
                'label' => $model->isNewRecord ? Yii::t('AweCrud.app', 'Create') : Yii::t('AweCrud.app', 'Save'),
                'htmlOptions' => array(
                    'class'=>"btn-sm",
                    'onClick' => 'js:ajaxSaveImagen("#entidad-foto-form")')
            ));
            ?>
            <button type="button" class="btn btn-sm btn-dark" data-dismiss="modal">Close</button>

        </div>    
    </div>

</div>


<?php $this->endWidget(); ?>

